package be.vdabantwerpen.gow.entities;




import be.vdabantwerpen.gow.exceptions.InvalidScoreValueException;

import com.google.appengine.repackaged.org.joda.time.DateTime;
import java.io.Serializable;

public class Score implements Serializable {
        private static final long serialversionUID = 1L;
	private GOWUser user;
	private Post post;
	private DateTime dateTime;
	private int value;
	
	public Score(Post post, DateTime dateTime, int value, GOWUser user)
	{
		setPost(post);
		setDateTime(dateTime);
		setValue(value);
		setUser(user);
	}
	
	public Score(Post post, DateTime dateTime, int value)
	{
		setPost(post);
		setDateTime(dateTime);
		setValue(value);
	}

	public GOWUser getUser()
	{
		return user;
	}

	public void setUser(GOWUser user)
	{
		this.user = user;
	}

	public Post getPost()
	{
		return post;
	}

	private void setPost(Post post)
	{
		this.post = post;
	}

	public DateTime getDateTime()
	{
		return dateTime;
	}

	private void setDateTime(DateTime dateTime)
	{
		this.dateTime = dateTime;
	}

	public int getValue()
	{
		return value;
	}

	public void setValue(int value)
	{
		if (value < 1 || value > 5)
		{
			throw new InvalidScoreValueException();
		}
		else
		{
			this.value = value;
		}
	}
}
